<?php
class Footermenu_Api_Core extends Core_Api_Abstract {
	public function Categories($cid = 0) {
		// Get table info
		$table = $table = Engine_Api::_ ()->getDbtable ( 'categories', 'footermenu' );
		$categoriesTableName = $table->info ( 'name' );
		$select = $table->select ()->from ( $categoriesTableName );
		$select->where ( "{$categoriesTableName}.cid = ?", $cid );
		$rawData = $table->fetchRow ( $select );
		return $rawData;
	}
	public function Collection() {
		// Get table info
		$table = $table = Engine_Api::_ ()->getDbtable ( 'collections', 'footermenu' );
		$categoriesTableName = $table->info ( 'name' );
		$select = $table->select ()->from ( $categoriesTableName );
		$rawData = $table->fetchAll ( $select );
		return count ( $rawData );
	}
	public function CollectionFirst() {
		// Get table info
		$table = $table = Engine_Api::_ ()->getDbtable ( 'collections', 'footermenu' );
		$categoriesTableName = $table->info ( 'name' );
		$select = $table->select ()->from ( $categoriesTableName );
		$rawData = $table->fetchRow ( $select );
		return $rawData->collection_id;
	}
}
